# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgbase=python-nplusone
pkgname=('python2-nplusone' 'python-nplusone')
_pkgname=nplusone
pkgver=1.0.0
pkgrel=8
pkgdesc='Detecting the n+1 queries problem in Python.'
arch=('any')
url='https://pypi.org/project/nplusone/#files'
license=('custom:unknown')
makedepends=('python2-setuptools' 'python-setuptools')
source=("https://files.pythonhosted.org/packages/source/${_pkgname::1}/$_pkgname/$_pkgname-$pkgver.tar.gz")
sha512sums=('505a6ab33851d691add686fe8b90af360df9ad04fea4fc0eafa08b9bd1e9fcc6659108a6594f5e1318ebb43d588032b0109881c2af1847f5a504d8081af96d56')

prepare() {
  cp -a "$_pkgname-$pkgver"{,-2}
}

build() {
  cd "$_pkgname-$pkgver-2"

  python2 setup.py build

  cd "$srcdir/$_pkgname-$pkgver"

  python setup.py build
}

package_python2-nplusone() {
  depends=('python2' 'python2-six' 'python2-blinker')

  cd "$_pkgname-$pkgver-2"

  python2 setup.py install --prefix=/usr --root="$pkgdir" --optimize=1 \
    --skip-build
}

package_python-nplusone() {
  depends=('python' 'python-six' 'python-blinker')

  cd "$_pkgname-$pkgver"

  python setup.py install --prefix=/usr --root="$pkgdir" --optimize=1 \
    --skip-build
}

